import Vue from 'vue'
import Router from 'vue-router'
// import home from '../pages/home/home.vue' //首页
let home = () => import('../pages/home/home.vue') //路由懒加载
// import order from '../pages/order/order.vue' //订单
let order = () => import('../pages/order/order.vue') //路由懒加载
import personal from '../pages/personal/personal.vue' //个人中心
import search from '../pages/search/search.vue' //搜索
import login from '../components/login/login.vue' //登录页面
import shop from '../components/shop/shop.vue' //商品
import shopinfo from '../components/shop/shopinfo/shopinfo.vue' //商家详情
import shopgood from '../components/shop/shopgood/shopgood.vue' //商品列表
import shoprating from '../components/shop/shoprating/shoprating.vue' //商品评级

Vue.use(Router)

export default new Router({
  routes: [{
      path: "",
      redirect: '/home' //重定向 如果路径为/自动换为首页
    },
    {
      path: '/home',
      name: "home",
      component: home, //首页
      meta: {
        footertable: true
      }
    },
    {
      path: '/order',
      name: "order",
      component: order, //订单
      meta: {
        footertable: true
      }
    }, {
      path: '/personal',
      name: "personal",
      component: personal, //个人中心
      meta: {
        footertable: true
      }
    }, {
      path: '/search',
      name: "search",
      component: search, //搜索
      meta: {
        footertable: true
      }
    },
    {
      path: '/login',
      name: 'login',
      component: login, //登录
      meta: {
        footertable: false
      }
    }, {
      path: '/shop',
      name: 'shop',
      component: shop, //商品
      children: [{
        path: '/shop/shopgood',
        name: 'shopgood',
        component: shopgood //商品列表
      }, {
        path: '/shop/shopinfo',
        name: 'shopinfo',
        component: shopinfo //商家详情
      }, {
        path: '/shop/shoprating',
        name: 'shoprating',
        component: shoprating //评级
      }, {
        path: '',
        redirect: '/shop/shopgood'
      }]
    }
  ],
  mode: "history", //清除地址栏的#号


})
